<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BadgerDB: badgerdb::FileIterator Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BadgerDB
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacebadgerdb.html">badgerdb</a></li><li class="navelem"><a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classbadgerdb_1_1_file_iterator-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">badgerdb::FileIterator Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Iterator for iterating over the pages in a file.  
 <a href="classbadgerdb_1_1_file_iterator.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a99bd5c0e0fac0493f9664409219ca88e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbadgerdb_1_1_file_iterator.html#a99bd5c0e0fac0493f9664409219ca88e">FileIterator</a> ()</td></tr>
<tr class="separator:a99bd5c0e0fac0493f9664409219ca88e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad286fc916be769b1bea154603b83ece0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbadgerdb_1_1_file_iterator.html#ad286fc916be769b1bea154603b83ece0">FileIterator</a> (<a class="el" href="classbadgerdb_1_1_file.html">File</a> *file)</td></tr>
<tr class="separator:ad286fc916be769b1bea154603b83ece0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afabd7eecd315a85f9eb602f71c6f88e3"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbadgerdb_1_1_file_iterator.html#afabd7eecd315a85f9eb602f71c6f88e3">FileIterator</a> (<a class="el" href="classbadgerdb_1_1_file.html">File</a> *file, <a class="el" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number)</td></tr>
<tr class="separator:afabd7eecd315a85f9eb602f71c6f88e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6fa0f1cef8b46bb933ce6f000276ab52"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbadgerdb_1_1_file_iterator.html#a6fa0f1cef8b46bb933ce6f000276ab52">operator++</a> ()</td></tr>
<tr class="separator:a6fa0f1cef8b46bb933ce6f000276ab52"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a997a4dc0a213e33384f82891135e41ec"><td class="memItemLeft" align="right" valign="top"><a id="a997a4dc0a213e33384f82891135e41ec"></a>
<a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a>&#160;</td><td class="memItemRight" valign="bottom"><b>operator++</b> (int)</td></tr>
<tr class="separator:a997a4dc0a213e33384f82891135e41ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5eff20ca4457438dd7ba2a09ec87703a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbadgerdb_1_1_file_iterator.html#a5eff20ca4457438dd7ba2a09ec87703a">operator==</a> (const <a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a> &amp;rhs) const</td></tr>
<tr class="separator:a5eff20ca4457438dd7ba2a09ec87703a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6cd221ac8648bb300a2d34afe77365ef"><td class="memItemLeft" align="right" valign="top"><a id="a6cd221ac8648bb300a2d34afe77365ef"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>operator!=</b> (const <a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a> &amp;rhs) const</td></tr>
<tr class="separator:a6cd221ac8648bb300a2d34afe77365ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab251231092c7b7b6895b82f44c24e832"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classbadgerdb_1_1_page.html">Page</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classbadgerdb_1_1_file_iterator.html#ab251231092c7b7b6895b82f44c24e832">operator*</a> () const</td></tr>
<tr class="separator:ab251231092c7b7b6895b82f44c24e832"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Iterator for iterating over the pages in a file. </p>
<p>This class provides a forward-only iterator for iterating over all of the pages in a file. </p>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00023">23</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a99bd5c0e0fac0493f9664409219ca88e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99bd5c0e0fac0493f9664409219ca88e">&#9670;&nbsp;</a></span>FileIterator() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">badgerdb::FileIterator::FileIterator </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Constructs an empty iterator. </p>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00028">28</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
<div class="fragment"><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;      : file_(NULL),</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;        current_page_number_(<a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>) {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;  }</div>
</div><!-- fragment -->
</div>
</div>
<a id="ad286fc916be769b1bea154603b83ece0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad286fc916be769b1bea154603b83ece0">&#9670;&nbsp;</a></span>FileIterator() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">badgerdb::FileIterator::FileIterator </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classbadgerdb_1_1_file.html">File</a> *&#160;</td>
          <td class="paramname"><em>file</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Constructors an iterator over the pages in a file, starting at the first page.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">file</td><td><a class="el" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a> to iterate over. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00039">39</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
<div class="fragment"><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;      : file_(file) {</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    assert(file_ != NULL);</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keyword">const</span> FileHeader&amp; header = file_-&gt;readHeader();</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    current_page_number_ = header.first_used_page;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;  }</div>
</div><!-- fragment -->
</div>
</div>
<a id="afabd7eecd315a85f9eb602f71c6f88e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afabd7eecd315a85f9eb602f71c6f88e3">&#9670;&nbsp;</a></span>FileIterator() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">badgerdb::FileIterator::FileIterator </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classbadgerdb_1_1_file.html">File</a> *&#160;</td>
          <td class="paramname"><em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a>&#160;</td>
          <td class="paramname"><em>page_number</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Constructs an iterator over the pages in a file, starting at the given page number.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">file</td><td><a class="el" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a> to iterate over. </td></tr>
    <tr><td class="paramname">page_number</td><td>Number of page to start iterator at. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00053">53</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
<div class="fragment"><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;      : file_(file),</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        current_page_number_(page_number) {</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  }</div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ab251231092c7b7b6895b82f44c24e832"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab251231092c7b7b6895b82f44c24e832">&#9670;&nbsp;</a></span>operator*()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classbadgerdb_1_1_page.html">Page</a> badgerdb::FileIterator::operator* </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Dereferences the iterator, returning a copy of the current page in the file.</p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> in file. </dd></dl>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00103">103</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
<div class="fragment"><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  { <span class="keywordflow">return</span> file_-&gt;<a class="code" href="classbadgerdb_1_1_file.html#a343b7fb1a238992f02454e9e81837acd">readPage</a>(current_page_number_); }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a6fa0f1cef8b46bb933ce6f000276ab52"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6fa0f1cef8b46bb933ce6f000276ab52">&#9670;&nbsp;</a></span>operator++()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a>&amp; badgerdb::FileIterator::operator++ </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Advances the iterator to the next page in the file. </p>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00061">61</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
<div class="fragment"><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;                                    {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    assert(file_ != NULL);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keyword">const</span> PageHeader&amp; header = file_-&gt;readPageHeader(current_page_number_);</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    current_page_number_ = header.next_page_number;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;  }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a5eff20ca4457438dd7ba2a09ec87703a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5eff20ca4457438dd7ba2a09ec87703a">&#9670;&nbsp;</a></span>operator==()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool badgerdb::FileIterator::operator== </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a> &amp;&#160;</td>
          <td class="paramname"><em>rhs</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns true if this iterator is equal to the given iterator.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rhs</td><td>Iterator to compare against. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if other iterator is equal to this one. </dd></dl>

<p class="definition">Definition at line <a class="el" href="file__iterator_8h_source.html#l00087">87</a> of file <a class="el" href="file__iterator_8h_source.html">file_iterator.h</a>.</p>
<div class="fragment"><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                                                        {</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keywordflow">return</span> file_-&gt;<a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>() == rhs.file_-&gt;filename() &amp;&amp;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        current_page_number_ == rhs.current_page_number_;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  }</div>
</div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/ubuntu/study/dbmslab/lab2/BufMgr/src/<a class="el" href="file__iterator_8h_source.html">file_iterator.h</a></li>
</ul>
</div><!-- contents -->
<div class="ttc" id="aclassbadgerdb_1_1_page_html_a785a1e756d47fb7f8f3603a3fe8ffcef"><div class="ttname"><a href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">badgerdb::Page::INVALID_NUMBER</a></div><div class="ttdeci">static const PageId INVALID_NUMBER</div><div class="ttdef"><b>Definition:</b> <a href="page_8h_source.html#l00123">page.h:123</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_af16040a60f18c99305348077ac9e8aa8"><div class="ttname"><a href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">badgerdb::File::filename</a></div><div class="ttdeci">const std::string &amp; filename() const</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00179">file.h:179</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a343b7fb1a238992f02454e9e81837acd"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a343b7fb1a238992f02454e9e81837acd">badgerdb::File::readPage</a></div><div class="ttdeci">Page readPage(const PageId page_number) const</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00149">file.cpp:149</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
